<?php

include 'TrainManager.php';

//Some data to use
$from = $_GET['inputFrom'];
$to = $_GET['inputTo'];
$uname = 'langerkanniet@gmail.com';
$pwd = 'IAoV4OhtZC9LnxYDhn9HCp8TtAnd3-wlfca_wriQQctaosaUjyaegg';

//Set up information for accessing the restful service
$domain = 'http://webservices.ns.nl';
$service = '/ns-api-treinplanner?';

$url = $domain.$service.'fromStation='.rawurlencode($from).'&toStation='.rawurlencode($to);

echo 'url: '.$url.'</br>';

$xml = TrainManager::connect($url, $uname, $pwd);
//var_dump($xml);
$stops = TrainManager::getStops($xml);

echo 'The train will stop at ';
echo '<ul>';
foreach ($stops as $station) {
	echo '<li>'.$station[0].' at '.$station[1].' at track '.$station[2].'</li>';
}
echo '</ul>';

?>